//
//  ZyaWarehouseModel.swift
//  SlaughterClient
//
//  Created by hudan on 2025/7/29.
//  Copyright © 2025 zwb. All rights reserved.
//

// 仓库
import Foundation
import SwiftyJSON

public struct ZyaWarehouseModel: SwiftyJSONAble {

    // MARK: Declaration for string constants to be used to decode and also serialize.
    private struct SerializationKeys {
        static let sStorageNm = "s_storage_nm"
        static let sStorageId = "s_storage_id"
    }

    // MARK: Properties
    public var sStorageNm: String?
    public var sStorageId: Int?

    // MARK: SwiftyJSON Initializers
    /// Initiates the instance based on the object.
    ///
    /// - parameter object: The object of either Dictionary or Array kind that was passed.
    /// - returns: An initialized instance of the class.
    public init(object: Any) {
        self.init(json: JSON(object))
    }

    /// Initiates the instance based on the JSON that was passed.
    ///
    /// - parameter json: JSON object from SwiftyJSON.
    public init(json: JSON) {
        sStorageNm = json[SerializationKeys.sStorageNm].string
        sStorageId = json[SerializationKeys.sStorageId].int
    }

    /// Generates description of the object in the form of a NSDictionary.
    ///
    /// - returns: A Key value pair containing all valid values in the object.
    public func dictionaryRepresentation() -> [String: Any] {
        var dictionary: [String: Any] = [:]
        if let value = sStorageNm { dictionary[SerializationKeys.sStorageNm] = value }
        if let value = sStorageId { dictionary[SerializationKeys.sStorageId] = value }
        return dictionary
    }

}
